import axios from "axios";
import {
  mapMutations,
  mapState
} from "vuex";

export default {
  data() {
    return {
      // skinType: 0,
    };
  },
  created() {},
  computed: {
    ...mapState(["skinType"])
  },
  methods: {
    ...mapMutations(["setSkinType"]),
    changeSkinEvent(skinType) {
      let params = {
        skinTheme: Number(skinType),
      }
      axios.post("skin/skin/save.do", params).then(res => {
        console.log(res)
        if (res.data.resultCode == 0) {
          this.showToast("保存成功", 1);
          this.setSkinType(skinType)
          // this.skinType = skinType;
        } else {
          this.showToast("保存失败", 2);
        }
      }).catch((error) => {
        console.log(error)
      })
    }
  }
}
